$(function() {
    var istrues = true,
        t = new Date().getTime();
    var csrfToken = $("#_csrf").val() || $('meta[name="csrf-token"]').attr("content");

    /**banner轮播*/
    var idx = 0;
    var timer = null;
    $("#js img").eq(idx).fadeIn().siblings("img").fadeOut();


    $("#jsNav a.trigger").on('click', function() {
        idx = $(this).index()
        $("#js img").eq(idx).fadeIn().siblings("img").fadeOut();
        $(this).addClass("imgSelected").siblings().removeClass("imgSelected");
    });

    var fun1 = function() {
        idx++;
        if (idx >= 5) {
            idx = 0
        }
        $("#jsNav a.trigger").eq(idx).click();
    };

    timer = setInterval(fun1, 3000);

    $('#js').on('mouseover', function() {
        clearTimeout(timer)
    });

    $('#js').on('mouseleave', function() {
        timer = setInterval(fun1, 3000);
    });



    /**热门商标转让*/
    $('.ch-inner .hi-right li').hover(function() {
        $(this).addClass('color').siblings().removeClass('color');
    });

    $(".figure-inner").superSlider({
        prevBtn: ".next",
        /*左按钮*/
        nextBtn: ".prev",
        /*右按钮*/
        listCont: "#roll",
        /*滚动列表外层*/
        scrollWhere: "next",
        /*自动滚动方向next*/
        delayTime: 1000,
        /*自动轮播时间间隔*/
        speed: 1000,
        /*滚动速度*/
        amount: 1,
        /*单次滚动数量*/
        showNum: 9,
        /*显示数量*/
        autoPlay: true,
        /*自动播放*/
    });
    $('#roll li').eq(4).addClass('active');

    function jjlist(id, num, tt) {
        var html = '';
        $("ul.contentSh_jj").html("");
        if (istrues) {
            istrues = false;
            $("ul.contentSh_jj").html('<li style="margin-left: 390px; margin-top: 50px;"><img src="../images/loading1.gif"></li>');
            // $.post("/products/forindex", {b:id,n:num,tt:tt,_csrf:csrfToken, t: Math.random()}, function (data) {
            $.ajax({
                type: "GET",
                url: "http://www.86sb.com/adv/sbadvad",
                dataType: 'jsonp',
                jsonp: 'callback',
                data: {
                    id: 'all',
                    lid: 48,
                    page: 1,
                    bigclassid: id,
                    name: '',
                    page_size: 8,
                    _csrf: csrfToken,
                    t: Math.random()
                },
                success: function(data) {
                    istrues = true;
                    if (data.result.data.length > 0) {
                        for (var i = 0; i < data.result.data.length; i++) {
                            var str = data.result.data[i]['sbname'];
                            html += '<li>\
										 <a target="_blank" href="/info-' + data.result.data[i]['id'] + '.html" title="' + str + '"">\
										 <img alt="尚标-' + str + '" width="215" height="160" src="' + data.result.data[i]['sbpic'] + '@!hyjs">\
										 <span>' + str.substr(0, 8) + '</span></a>\
									 </li>';
                        }
                    } else {
                        html += '<li style="margin-left: 250px; margin-top: 50px;"><a href="javascript:void(0);" onClick="toswt();return false;" ><img src="../images/nodata1.png"></a></li>';
                    }
                    $("ul.contentSh_jj").html(html);
                    istrues = true;
                }

            });
            // }, "json");
        }
    }
    $('.sideBarList_jj li').bind("mouseenter", function(event) {
        var id = $(this).attr("title");
        // jjlist(parseInt(id), 8, 1);
    });
    /**默认25类*/
    // jjlist(25, 8, 1);

});